import pylab as plt
import numpy as np
from  params  import *

#params = {'xtick.labelsize': 12}
#pylab.rcParams.update(params)

x1 = [2*767, 2*3929, 2*96, 2*4793, 2*89961]
x1 = map(lambda x: x*189512/2, x1)
x2 = [2*664, 2*3031, 2*74, 2*3770, 2*70346]
x2 = map(lambda x: x*148234/2, x2)

i1 = [3987, 34170, 1435, 18515, 250755]
i2 = [5421, 46712, 1939, 26943, 351036]
i3 = [4758, 37035, 1673, 22853, 303332]

x = [0.5*sum(d) for d in zip(x1,x2)]
i = map(lambda x: 1.0/x, [0.333*sum(d) for d in zip(i1,i2,i3)])
i = map(lambda x: x, [0.333*sum(d) for d in zip(i1,i2,i3)])

ind = np.arange(len(x))
width=0.8
lbl = (r'$S_t$', r'$P_t$', r'$S_t \cap P_t$', r'$S_t \cup P_t$', r'$E_t$')

ROT = 0
plt.figure()
plt.clf()
plt.axes(FIG_AXES2)
plt.bar(ind, x, width=width, log=True,color='k')
#plt.ylabel('Prediction space size')
plt.xticks(ind+width/2.,lbl,rotation=ROT)
#plt.yticks([1e+9, 1e+10],[r"$10^9$",r"$10^{10}$"])
plt.grid(True)
plt.savefig('placefriends_candidates.pdf')
plt.close()

plt.figure()
plt.clf()
plt.axes(FIG_AXES2)
plt.bar(ind, i, width=width, log=True,color='k')
#plt.ylabel('Success rate')
plt.xticks(ind+width/2.,lbl,rotation=ROT)
plt.grid(True)
plt.savefig('placefriends_success.pdf')
plt.close()
